package org.tuio4j.message;

import com.illposed.osc.OSCMessage;

/**
 * See license.txt for license information.
 * @author Uwe Laufs
 * @version 1.1
 */
public class TuioMessage {
	private OSCMessage oscMessage;
	
	public TuioMessage(OSCMessage m){
		this.oscMessage = m;
	}
	public OSCMessage getOscMessage() {
		return oscMessage;
	}
	public String getMessageAdress() {
		return oscMessage.getAddress();
	}
	public Object[] getMessageArguments() {
		return oscMessage.getArguments();
	}
	@Override
	public String toString() {
		StringBuffer sb = new StringBuffer();
		sb.append(getMessageAdress());
		Object[] args = getMessageArguments();
		sb.append("[");
		for (int i = 0; i < args.length; i++) {
			sb.append(args[i]);
			if(i<(args.length-1)){
				sb.append(" ");
			}
		}
		sb.append("]");
		return new String(sb);
	}
	/**
	 * Provides a raw OSC message string which can be useful for debugging.
	 * @return The string representation of the underlying binary OSC message.
	 */
	public String toBinaryString() {
		return new String(oscMessage.getByteArray());
	}
}
